package com.demo.example;


import io.seata.spring.annotation.GlobalTransactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class TestControl {

    @Autowired
    private TestService testService;
    @GetMapping(value = "/main/tet/{type}")
    @GlobalTransactional(name="dept-service",rollbackFor = Exception.class)
    public String test(@PathVariable("type") String string)
    {
        Test1 test = new Test1();
        test.setId(1);
        test.setSex(1);
        test.setName(string);
        testService.updateTest1(test);
        return "para2:"+string+";";
    }

    @GetMapping(value = "/main/tt1",produces="application/json;charset=UTF-8")
    public String test()
    {
        return "para2:";
    }

}
